package dao

import (
	"gitee.com/shuwenhe/shuwen/session/model"
	"gitee.com/shuwenhe/shuwen/session/util"
)

func AddSession(sess *model.Session) error {
	sql := "insert into session values(?,?,?)"
	_, err := util.Db.Exec(sql, sess.SessionID, sess.UserName, sess.UserID)
	if err != nil {
		return err
	}
	return nil
}

func DeleteSession(sessID string) error { // 删除数据库中的Session
	sql := "delete from session where session_id = ?"
	_, err := util.Db.Exec(sql, sessID)
	if err != nil {
		return err
	}
	return nil
}
